<template>
	<view class="selectUnit">
		<!-- 选择单元 -->

		<view class="content">
			<navigator   @click="passMsg(v.unitName)" hover-class="navigator-hover" open-type="navigateBack"
				v-for="v in unitData" :key="v.id">
				<view class="item">
					{{v.unitName}}
				</view>
			</navigator>
		</view>
	</view>
</template>

<script>
	import {
		http
	} from "../../../../utils/http.js"
	export default {
		data() {
			return {
				unitData:[],
				buildingName:""
			};
		},
		methods:{
			getData(){
				http({
					url:"/towerUnit/list",
					method:"get",
					
				}).then(({data})=>{
					console.log(data)					
					this.unitData=data
				})
			},
			passMsg(v){
				console.log(v,"单元")
				uni.navigateTo({
					url: '../addHouse?unitName='+v
				});
			
			}
		},
		onLoad(option){
			this.getData()

		}
	}
</script>

<style lang="less">
.selectUnit{
	.content {
		padding: 0 9rpx;
		padding-top: 76rpx;
		display: flex;
		flex-wrap: wrap;
	
		.item {
			width: 204rpx;
			height: 100rpx;
			text-align: center;
			margin: 19rpx;
			line-height: 100rpx;
			border-radius: 10rpx;
			border: 1px solid #ccc;
		}
	}
}
</style>
